home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / appsrcs.zip / APPMORE.ZIP / APPDRAW.C < prev    next >
C/C++ Source or Header  |  1993-04-08  |  2KB  |  82 lines

  1. /*--------------------------------------------------------------------------*/
  2. /* AppDraw.c                                                                            */
  3. /*--------------------------------------------------------------------------*/
  4. #define STRICT
  5. #include <windows.h>
  6. #include <windowsx.h>
  7. #include "appmore.h"
  8.  
  9. /*-------------------------------------------------------------------------*/
  10. void DrawItem(LPDRAWITEMSTRUCT lpIconDIS, HICON *hIcon)
  11.     {
  12.     iCurrent = (int) (lpIconDIS->CtlID - ID_BUTTON1);
  13.     hWndCurrentButton = lpIconDIS->hwndItem;
  14.     if(!AppSystem.BigButtons)
  15.     {
  16.     if(iCurrent == SYSTEM_BUTTON)
  17.         {
  18.         DrawIcon(lpIconDIS->hDC, 0, 0, hSystem);
  19.         if(bQuickLoad)
  20.         DrawIcon(lpIconDIS->hDC, 0, 0, hQuickLoad);
  21.         }
  22.     if(iCurrent >= FirstAppButton)
  23.         {
  24.         if(hIcon[iCurrent-FirstAppButton] != NULL)
  25.         {
  26.         if(AppButton[iCurrent-FirstAppButton].ButtonLook)
  27.             DrawIcon(lpIconDIS->hDC, 0, 0, hBlank);
  28.         DrawIcon(lpIconDIS->hDC, 0, 0, hIcon[iCurrent-FirstAppButton]);
  29.         }
  30.         else
  31.         DrawIcon(lpIconDIS->hDC, 0, 0, hBlank);
  32.         if(AppButton[iCurrent-FirstAppButton].ProgStatus == ALIVE)
  33.         DrawIcon(lpIconDIS->hDC, 0, 0, hPressed);
  34.         }
  35.     if(bKeyboardOn == TRUE)
  36.         if(iCurrent == iKey)
  37.         DrawIcon(lpIconDIS->hDC, 0, 0, hKeybOn);
  38.     }
  39.     if(AppSystem.BigButtons)
  40.     {
  41.     DrawBitmap(lpIconDIS->hDC, 0, 0, hbBlank);
  42.     if(bKeyboardOn == TRUE)
  43.         if(iCurrent == iKey)
  44.         DrawBitmap(lpIconDIS->hDC, 0, 0, hbKeyb);
  45.     if(iCurrent == SYSTEM_BUTTON)
  46.         {
  47.         DrawIcon(lpIconDIS->hDC, 3, 3, hSystem2);
  48.         if(bQuickLoad)
  49.         DrawIcon(lpIconDIS->hDC, 3, 3, hQuickLoad);
  50.         }
  51.     if(iCurrent >= FirstAppButton)
  52.         {
  53.         if(hIcon[iCurrent-FirstAppButton] != NULL)
  54.         {
  55.         if(AppButton[iCurrent-FirstAppButton].ProgStatus == ALIVE)
  56.             DrawBitmap(lpIconDIS->hDC, 0, 0, hbPressed);
  57.         DrawIcon(lpIconDIS->hDC, 3, 3, hIcon[iCurrent-FirstAppButton]);
  58.         if(AppButton[iCurrent-FirstAppButton].ProgStatus == ALIVE)
  59.             DrawIcon(lpIconDIS->hDC, 3, 3, hPressed2);
  60.         }
  61.         }
  62.     }
  63.     }
  64.  
  65. /*-------------------------------------------------------------------------*/
  66. void DrawBitmap(HDC hdc, short x, short y, HBITMAP hBitmap)
  67.     {
  68.     BITMAP bm;
  69.     HDC    hMemDC;
  70.     POINT  pt;
  71.  
  72.     hMemDC = CreateCompatibleDC(hdc);
  73.     SelectObject(hMemDC, hBitmap);
  74.     GetObject(hBitmap, sizeof(BITMAP), (LPSTR) &bm);
  75.     pt.x = bm.bmWidth;
  76.     pt.y = bm.bmHeight;
  77.  
  78.     BitBlt(hdc, x, y, pt.x, pt.y, hMemDC, 0, 0, SRCCOPY);
  79.  
  80.     DeleteDC(hMemDC);
  81.     }
  82.